home *** CD-ROM | disk | FTP | other *** search
/ PC User 2005 May / CD / PCU0505CD.iso / software / online / files / fedemon.exe / {app} / Data / defaults / styles / Expando.fdxsl < prev    next >
Encoding:
Extensible Markup Language  |  2005-01-10  |  6.6 KB  |  182 lines

  1. <?xml version="1.0"?>
  2.  
  3. <xsl:stylesheet version="1.0"
  4.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.     xmlns:fd="http://www.bradsoft.com/feeddemon/xmlns/1.0/">
  6. <xsl:output method="html"/>
  7.  
  8. <!-- images -->
  9. <xsl:variable name="collapse-img" select="'$IMAGEDIR$collapse.gif'"/>
  10. <xsl:variable name="expand-img" select="'$IMAGEDIR$expand.gif'"/>
  11. <xsl:variable name="enclosure-img" select="'$IMAGEDIR$enclosure.gif'"/>
  12. <xsl:variable name="comment-img" select="'$IMAGEDIR$comments.gif'"/>
  13. <xsl:variable name="link-img" select="'$IMAGEDIR$link.gif'"/>
  14.  
  15. <!-- count of news items -->
  16. <xsl:variable name="item-count" select="count(/newspaper/channel/item)"/>
  17.  
  18. <!-- default class for item detail - defaults to collapsed unless this is a single item newspaper -->
  19. <xsl:variable name="item-detail-class">
  20.     <xsl:choose>
  21.         <xsl:when test="$item-count=1">expanded</xsl:when>
  22.         <xsl:otherwise>collapsed</xsl:otherwise>
  23.     </xsl:choose>
  24. </xsl:variable>    
  25.  
  26. <xsl:variable name="common-styles">
  27.     <style type="text/css">
  28.         body, div.channelnewsitems { background-color: #F2F9FB; }
  29.         body { 
  30.             font: 84% "Trebuchet MS", Tahoma, sans-serif; 
  31.             margin: 8px 16px; 
  32.             filter: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#EFF6F8,endColorStr=#CAE5EA); 
  33.         }
  34.         a { color: #006ABA;  }
  35.         a:hover { color: #C3756F; }
  36.         span.nodescription { font-size: x-small; color: silver;}
  37.         div.newspapertitle { font-weight: bold; font-size: 130%; text-align: center; margin: 16px 2px; }
  38.         div.newsitemtitle { }
  39.         div.newsitem { margin-bottom: 4px; }
  40.         div.newsitemcontent {
  41.             margin: 6px 18px;
  42.             border: 1px solid #C2E0E7;
  43.             padding: 8px 16px;
  44.             color: #484848;
  45.             background-color: white;
  46.             overflow: visible; 
  47.             /*height: 1px; */
  48.         }
  49.         .newsitemsource, .dateline { color: #898989; font-size: xx-small; }
  50.         .newsitemsource { text-align: right; }
  51.         .collapsed { display: none; }
  52.         img.icon { border: none; }
  53.         img.button { margin-right: 6px; }
  54.         /*div.newsitem { border-bottom: 1px dotted #D8D8D8;    }*/
  55.     </style>
  56. </xsl:variable>
  57.  
  58. <xsl:variable name="common-scripts">
  59.     <script>
  60.         function collapseItem(itemid) {
  61.             document.getElementById(itemid + '_expanded').style.display = 'inline';
  62.             document.getElementById(itemid + '_collapsed').style.display = 'none';
  63.             document.getElementById(itemid + '_detail').style.display = 'none';
  64.         }
  65.         function expandItem(itemid) {
  66.             document.getElementById(itemid + '_expanded').style.display = 'none';
  67.             document.getElementById(itemid + '_collapsed').style.display = 'inline';
  68.             document.getElementById(itemid + '_detail').style.display = 'block';
  69.         }
  70.     </script>
  71. </xsl:variable>
  72.  
  73. <!-- channel group -->
  74. <xsl:template match="newspaper[@type='group']">
  75.     <html>
  76.     <head>
  77.         <title>Group Newspaper</title>
  78.         <xsl:copy-of select="$common-styles"/>
  79.         <style type="text/css">
  80.             div.newsitem { padding-bottom: 1px; }
  81.             div.newsitem, div.channelnewsitems { background-color: #F7FBFC; }
  82.             div.channelnewsitems, div.channeltitle { border: 1px solid #52AABE; }
  83.             div.channelnewsitems { padding: 8px 12px; margin-bottom: 14px; }
  84.             div.channeltitle { border-bottom: none; font-weight: bold; text-transform: uppercase; text-align: center; background-color: #A0D3E1; }
  85.             div.channeltitle, div.channeltitle a { color: #256576; text-decoration: none; }
  86.         </style>
  87.         <xsl:copy-of select="$common-scripts"/>
  88.     </head>
  89.     <body>
  90.         <xsl:if test="title">
  91.             <div class="newspapertitle">
  92.                 <xsl:value-of select="title" disable-output-escaping="yes"/>
  93.             </div>
  94.         </xsl:if>
  95.         
  96.         <xsl:for-each select="channel">
  97.             <div class="channeltitle">
  98.                 <xsl:variable name="chanlink" select="link"/>
  99.                 <a href="{$chanlink}"><xsl:value-of select="title"/></a>
  100.             </div>
  101.             <div class="channelnewsitems">        
  102.                 <xsl:for-each select="item">
  103.                     <xsl:sort select="fd:sortKey" data-type="number" order="descending"/>
  104.                     <xsl:apply-templates select="."/>
  105.                 </xsl:for-each>
  106.             </div>
  107.         </xsl:for-each>    
  108.     </body>
  109.     </html>
  110. </xsl:template>
  111.  
  112. <!-- news item and channel -->
  113. <xsl:template match="newspaper[@type='newsitem' or @type='channel']">
  114.     <html>
  115.     <head>
  116.         <title>Newspaper</title>
  117.         <xsl:copy-of select="$common-styles"/>
  118.         <xsl:copy-of select="$common-scripts"/>
  119.     </head>
  120.     <body>
  121.         <xsl:if test="title">
  122.             <div class="newspapertitle">
  123.                 <xsl:value-of select="title" disable-output-escaping="yes"/>
  124.             </div>
  125.         </xsl:if>
  126.         <xsl:for-each select="channel/item">
  127.             <xsl:sort select="fd:sortKey" data-type="number" order="descending"/>
  128.             <xsl:apply-templates select="."/>
  129.         </xsl:for-each>
  130.     </body>
  131.     </html>    
  132. </xsl:template>
  133.  
  134. <!-- news item template -->
  135. <xsl:template match="item">
  136.     <!-- generate unique ID for this item -->
  137.     <xsl:variable name="itemid"><xsl:value-of select="generate-id()"/></xsl:variable>
  138.  
  139.     <div class="newsitem">
  140.         <div class="newsitemtitle">
  141.             <!-- don't show +/- for single item newspaper -->
  142.             <xsl:if test="$item-count > 1">
  143.                <a class="expanded" href="javascript:expandItem('{$itemid}')" id="{$itemid}_expanded">
  144.                    <img src="{$expand-img}" border="0" align="absmiddle" class="button" />
  145.                </a>
  146.                <a class="collapsed" href="javascript:collapseItem('{$itemid}')" id="{$itemid}_collapsed">
  147.                    <img src="{$collapse-img}" border="0" align="absmiddle" class="button" />
  148.                </a>
  149.             </xsl:if>
  150.             
  151.             <xsl:variable name="itemlink" select="link"/>
  152.          <a href="{$itemlink}"><xsl:value-of select="title" disable-output-escaping="yes"/></a>
  153.             <span class="dateline">
  154.                    [ <xsl:value-of select="fd:dateDisplay"/> ]
  155.             </span>
  156.         </div>
  157.         <div id="{$itemid}_detail" class="{$item-detail-class}">
  158.             <div class="newsitemcontent">
  159.                 <xsl:value-of select="description" disable-output-escaping="yes"/>
  160.                 <div class="newsitemsource">
  161.                         <xsl:variable name="srclink" select="source/@htmlUrl"/>
  162.                         [ 
  163.                           <xsl:if test="author"><xsl:value-of select="author" disable-output-escaping="yes"/> | </xsl:if> 
  164.                           <a href="{$srclink}"><xsl:value-of select="source"/></a> 
  165.                             <!-- add link to comments if available -->
  166.                             <xsl:if test="comments">
  167.                                 <xsl:variable name="commentlink" select="comments"/>
  168.                                 | <a href="{$commentlink}"><img src="{$comment-img}" class="icon" align="absmiddle" /></a> 
  169.                             </xsl:if>
  170.                             <!-- add link to enclosure if available -->
  171.                             <xsl:if test="enclosure">
  172.                                 <xsl:variable name="enclosurelink" select="enclosure/@url"/>
  173.                                 | <a href="{$enclosurelink}" title="{$enclosurelink}"><img src="{$enclosure-img}" class="icon" align="absmiddle" /></a>
  174.                             </xsl:if>                    
  175.                         ]
  176.                 </div>
  177.             </div>
  178.         </div>
  179.     </div>
  180. </xsl:template>
  181.  
  182. </xsl:stylesheet>